<?php


namespace app\services\user;


use app\models\user\UserModel;
use app\services\BaseService;
use think\facade\Db;

class UserService extends BaseService
{
    protected static function initModel()
    {
        return new UserModel();
    }


    public static function geyUserInfo($userId)
    {
        try {
            $field = 'id,avatar,nick,mobile,sex,level_id,status,label,accumulated_rewards,accumulated_rewards';
            $info = self::initModel()->where('id',$userId)->field($field)->find();

            if($info){
                return $info;
            }else{
                throw new \Exception('用户信息未找到');
            }
        } catch (\Exception $exception) {
            throw new \Exception($exception->getMessage());
        }

    }

}